#include <iostream>
using std::cout;
using std::endl;

class Point
{
public:
    Point()
    : _ix(0)
    , _iy(0)
    {
        cout << "Point()" << endl;
    }

    Point(int x,int y = 1)
    : _ix(x)
    , _iy(y)
    {
        cout << "Point(int,int)" << endl;
    }
    Point(const Point & rhs)
    : _ix(rhs._ix)
    , _iy(rhs._iy)
    {
        cout << "拷贝构造" << endl;
    }

    void print(){
        cout << "(" << _ix
            << "," << _iy
            << ")" << endl;
    }
private:
    int _ix;
    int _iy;
};

void test0(){
    //能够取地址的内容是左值（持续存在）
    //不能取地址的内容是右值（即将销毁）
    //临时变量（匿名变量）、临时对象（匿名对象）、字面值
    /* &1;//存于指令系统，不在内存中 */

    int a = 10;
    int b = 20;
    cout << &a << endl;
    /* &(a + b); */
    cout << &(++a) << endl;
    /* &(a++); */

    Point pt(1,2);
    &pt;
    /* &Point(3,4); */
}

void test1(){
    int a = 10;
    int b = 20;
    //非const引用只能绑定左值
    //const引用能够绑定左值，也能绑定右值
    int & ref = a;
    const int & ref2 = b;
    /* int & ref3 = a + b; */
    const int & ref4 = a + b;
}

int main(void){
    test1();
    return 0;
}
